import ssl
import socket
import urllib.request
url="https://avatars.mds.yandex.net/get-zen_doc/4426015/pub_60c333ea0f49c61cbce76be9_60c33a3b389d441696047e2c/scale_1200";
filename=url.split('/')[-1]
urllib.request.urlretrieve(url,filename)

# SET VARIABLES

hostname = '127.0.0.1'
# PROTOCOL_TLS_CLIENT требует действительной цепочки сертификатов и имени хоста
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.load_verify_locations('path/to/cabundle.pem')

with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
    with context.wrap_socket(sock, server_hostname=hostname) as ssock:
        print(ssock.version())

# #// s https://runebook.dev/ru/docs/python/library/ssl
# context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
# context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')

# with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
    # sock.bind(('127.0.0.1', 8443))
    # sock.listen(5)
    # with context.wrap_socket(sock, server_side=True) as ssock:
        # conn, addr = ssock.accept()
